{extend name="layout" /}
{block name="css"}
<link rel="stylesheet" href="{$statics}plugins/select2/select2.css">
<link href="{$statics}plugins/um/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
{/block}
{block name="content"}
<!-- <section class="content" style="padding-top:0;padding-bottom: 0">
<div class="row" style="padding-bottom: 0">
<div class="box" style="margin-bottom: 0"> -->
    <!-- <div class="box-header with-border">
      <h3 class="box-title"><i class="fa fa-building-o"></i> 系统配置</h3>
    </div> -->
    <!-- /.box-header -->
    <!-- <div class="box-body"> -->
      <form role="form" id="configform" action="{:url('save_config')}">
      <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="margin:0">
        <ul class="layui-tab-title">
          {foreach Think.config.CONFIG_GROUP_LIST as $k => $v}
          {neq name="k" value="0"}
          <li {eq name="k" value="1"}class="layui-this"{/eq}>{$v}</li>
          {/neq}
          {/foreach}
        </ul>
        <div class="layui-tab-content" style="height: 100%">
          {foreach Think.config.CONFIG_GROUP_LIST as $ks => $vs}
          {neq name="ks" value="0"}
          <div class="layui-tab-item {eq name="ks" value="1"}layui-show{/eq}">
            <div class="box-body">
            {volist name=":get_model_func('Config','list_data',['group'=>$ks])" id="v"}
              <div class="form-group">
                <label for="exampleInputEmail1">{$v.title}<span class="check-tips">（{$v.remark}）</span></label>
                {switch name="v.type"}
                {case value="0"}
                  <input type="text" class="form-control input-sm" name="config[{$v.name}]" value="{$v.value}">
                {/case}
                {case value="1"}
                  <input type="text" class="form-control" name="config[{$v.name}]" value="{$v.value}">
                {/case}
                {case value="2"}
                  <textarea name="config[{$v.name}]" class="form-control">{$v.value}</textarea>
                {/case}
                {case value="3"}
                  <textarea name="config[{$v.name}]" class="form-control">{$v.value}</textarea>
                {/case}
                {case value="4"}
                  <select name="config[{$v.name}]" class="form-control">
                  {volist name=":parse_config_attr($v['extra'])" id="vo"}
                    <option value="{$key}" {eq name="v.value" value="$key"}selected{/eq}>{$vo}</option>
                  {/volist}
                  </select>
                {/case}
                {case value="5"}
                {:trace($v.value)}
                  <textarea name="config[{$v.name}]" id="myEditor_{$v.name}" class="form-control editor" style="height:240px;">{$v.value}</textarea>
                {/case}
                {/switch}
              </div>
            {/volist}
            </div>
          </div>
          {/neq}
          {/foreach}
        </div>
      </div>
      </form>
    <!-- </div>-->
    <div class="box-footer">
      <button type="button" class="btn btn-block btn-success cocoAjaxForm" formid="configform">保存</button>
    <!--</div>-->
  </div>
<!-- </div> -->
<!-- </section> -->
{/block}
{block name="script"}
<script src="{$statics}plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="{$statics}plugins/um/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{$statics}plugins/um/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{$statics}plugins/um/umeditor.min.js"></script>
<script type="text/javascript" src="{$statics}plugins/um/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
  $(".editor").each(function(){
    var editorId = $(this).attr('id');
    var um = UM.getEditor(editorId,{initialFrameWidth:null});
  });
</script>
<script languange="Javascript">
layui.use('element');
</script>
{/block}